 //编辑题目选项的恢复
	function  EditOptions(url)
	{
		$.post(url, function(data){
		    
			var questionsLength = data.length;
			//增加选项
			if(questionsLength>2)
			{
				//增加选项
				for(var i = 0;i<questionsLength-2;i++)
				{
					AddOptions();
				}
			}
			
			 var  answerarray= $("input[name^='options']");
			for(var i = 0;i<data.length;i++){
			 
				var Option_Name = RemoveSpace(data[i].Option_Name);
				$(answerarray[i]).val(Option_Name);
			}
		
		});
	}
	//编辑题目答案的恢复
	function  EditAnwser(url,type)
	{
		$.post(url, function(data){
		    
			//单选
			if(type==0)
			{
				 var Answer_Index = data[0].Answer_Index;
				 _form.val("layuiadmin-app-form-list", {
				   "radioItem": Answer_Index 
				 });
				 
			}
			//多选
			else
			{
				 var checkBoxArray = [];
				 for(var i = 0;i<data.length;i++){
				  
				 	var Answer_Index = data[i].Answer_Index;
					checkBoxArray.push(Answer_Index);
				 }
			
				  var checkboxGrounp = $("input[name='checkBoxItem']");
			     
				  for(var i = 0;i<checkboxGrounp.length;i++)
				  {
					  for(var k = 0;k<checkBoxArray.length;k++)
					  {
					  	  if(i==checkBoxArray[k])
						  {
							  checkboxGrounp[i].checked = true;
						  }
					  }
				  }
				 
			}
			  _form.render();
			
		});
	}
	
	function SetEdit(prefixUrl,form)
	{
		var ID = GetQueryVariable("ID");
		if(ID!=false)
		{
			//填充Question
			var url = prefixUrl+"Question/SearchDetails/"+ID;
			$.post(url, function(data){
			    
				  form.val("layuiadmin-app-form-list", { 
				    "Question_Title": RemoveSpace(data.data.Question_Title) 
				    ,"Question_Type": data.data.Question_Type
					,"Question_ID" : ID
					,"upload_fileName" : data.data.Pic_Path
				  });
				  
				  SetSelect(data.data.Question_Type);
				  
				  var optionUrl = prefixUrl+"Question/SearchOptionsDetails/"+ID;
				  var answerUrl = prefixUrl+"Question/SearchAnwserDetails/"+ID;
				  
				  EditOptions(optionUrl);
				  setTimeout(function () {
				      EditAnwser(answerUrl,data.data.Question_Type);
				  }, 300); 
				  
			});
			
			
		}
	}